import md5 from 'js-md5'
import JSEncrypt from 'jsencrypt'

const rsaEncrypt = (publicKey, value) => {
   let jsEncrypt = new JSEncrypt()
   jsEncrypt.setPublicKey(publicKey)
   return jsEncrypt.encrypt(value)
}

const rsaDecrypt = (privatekey, value) => {
   let jsEncrypt = new JSEncrypt()
   jsEncrypt.setPrivateKey(privatekey)
   return jsEncrypt.decrypt(value)
}

export {
   md5,
   rsaEncrypt,
   rsaDecrypt
}